<template>
  <div>
    <el-col :span="24" class="bg1">
      <div class="grid-content bg-purple">
        <FormPanel ref="formPanel" :list="formList" :cols="3" :labelWidth="110" :isSubmitBtn="false"/>
      </div>
    </el-col>

    <div class="dialogBottmView">
      <el-button size="small" type="primary" class="btnStyle" @click="closeMenu('3')">关闭
      </el-button>

    </div>

  </div>
</template>

<script>
  import {getByThreeId} from '@/api/repair/threePacksOfManager/regulationsQueryCDuan';


  import {dictionary} from '@/utils/dictMixin';
  import {isEmpty} from '@/utils/utils';
  import {exportExcelFile} from '@/utils/index';

  export default {
    name: 'detail',
    mixins: [dictionary],
    /*handleType show   活动审核  show-1  索赔审核*/
    props: ['handleType', 'threeId'],
    data()
    {
      this.saveData = null;
      return {

        formList: this.createFormList(),
        detailObj: {},
      };
    },
    components: {},
    mounted()
    {
      this.getData();


    },
    methods: {

      /*根据ID查询*/
      async getData()
      {
        let res = await getByThreeId({'id': this.threeId});

        if (res.resultCode == 200 && res.success == true)
        {
          let data = isEmpty(res['data']) ? {} : res['data'];

          for (let i in data)
          {
            this.formList.map(x =>
            {
              if (i == x.fieldName)
              {
                x.initialValue = data[i];
              }
            });
          }
        }

      },
      async closeMenu(type)
      {
        this.$emit('close')
      },

      createFormList()
      {

        return [
          {
            type: 'BREAK_SPACE',
            label: '三包法规信息',
          },

          {
            type: 'INPUT',
            label: '规则编号',
            fieldName: 'threeNo',
            itemList: [],
            disabled: true,
            placeholder: '',
            // rules: [{required: true, trigger: 'change'}],
            initialValue: ''
          },
          {
            type: 'INPUT',
            label: '规则名称',
            fieldName: 'name',
            disabled: true,
            rules: [{required: false, trigger: 'change'}],
            placeholder: '请输入',
            initialValue: ''
          },
          {
            type: 'SELECT',
            label: '规则类型',
            fieldName: 'type',
            placeholder: '',
            disabled: true,
            rules: [{required: false, trigger: 'change'}],
            initialValue: '',
            itemList: this.createDictList(1023)

          },
          {
            type: 'INPUT',
            label: '法定时限',
            fieldName: 'months',
            placeholder: '请选择',
            disabled: true,
            style: {width: '100px'},
            initialValue: '',
            descOptions: {
              content: '月',
              style: {
                // textAlign: 'center',
                // backgroundColor:'#00feff'
              }
            }
          },
          {
            type: 'INPUT',
            label: '法定里程',
            fieldName: 'mileage',
            placeholder: '请选择',
            disabled: true,
            initialValue: '',
            style: {width: '100px'},
            descOptions: {
              content: 'KM',

            }
          },
          {
            type: 'INPUT',
            label: '法定数量',
            fieldName: 'counts',
            placeholder: '请选择',
            disabled: true,
            style: {width: '100px'},
            rules: [{required: false, trigger: 'change'}],
            initialValue: '',
            descOptions: {
              content: '次',

            }
          },
          {
            type: 'TEXT_AREA',
            label: '规则描述',
            fieldName: 'remarks',
            placeholder: '请选择',
            disabled: true,
            rules: [{required: false, trigger: 'change'}],
            initialValue: '',
            selfCols: 3
          },
        ];
      },
    }
  };
</script>

<style scoped lang="less">
  .bg1 {
    border: 1px solid @borderColor;
    border-radius: @borderRadius;
    box-shadow: @boxShadow;
    padding: @modulePadding;
    padding-left: 0;
    padding-top: 15px;
    padding-bottom: 15px;
  }

  .bg2 {
    margin-top: 10px;
    margin-bottom: 10px;
  }

  .btn {
    text-align: center;
  }

  .btnStyle {
    margin-top: 10px;
  }
</style>
